package com.zzyl.service.customer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
@Slf4j
public class MyTask {
    @Autowired
    private CustomerReservationService customerReservationService;
    /**
     * 定时任务,每个小时的1分和31分触发
     */
    @Scheduled(cron = "0 1,31 * * * ?")
    public void task() {
        LocalDateTime now = LocalDateTime.now();
        customerReservationService.updateStatusByTask(now);

    }
}
